package test1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-03-30
 * Time: 17:34
 */


class Board {
    public boolean checkWon(int[][] board) {
        // write code here
        boolean flag = false;
        int n = board.length;
        int sumDia = 0;
        for (int i = 0; i < n; i++) {
            int sumRow = 0;
            int sumCol = 0;
            for (int j = 0; j < n; j++) {
                sumRow += board[i][j];
                sumCol += board[j][i];
                if (i == j) {
                    sumDia += board[i][j];
                }
            }
            if (sumRow == n || sumCol == n) {
                return true;
            }
        }
        return sumDia == n;
    }
}
